<%@ page import="org.apache.commons.lang.StringUtils,com.hz.framework.util.BusinessException" %>
<%@ page contentType="text/html;charset=UTF-8" %>
<jsp:useBean id="dao" class="com.hz.supermanage.dao.OrganizationDao" />
<%
request.setCharacterEncoding("UTF-8");
	String body="";
    try {
        String empId = request.getParameter("empId");
        String posId = request.getParameter("posId");
        String deptId = request.getParameter("deptId");
        String orgId = request.getParameter("orgId");
        if (StringUtils.isBlank(empId)) {
             throw new BusinessException("用户标识不能为空");
        }

        if (StringUtils.isEmpty(posId)) {
            throw new BusinessException("岗位标识不能为空");
        }

        if (StringUtils.isEmpty(deptId)) {
            throw new BusinessException("部门标识不能为空");
        }

        if (StringUtils.isEmpty(orgId)) {
            throw new BusinessException("岗位标识不能为空");
        }
        
        String[] hql= new String[2];
        hql[0] ="update HzsysEmpholdpost set posid='"+posId+"',depid='"+deptId+"',orgid='"+orgId+"' where perid='"+empId+"' and ptype='1'";
        hql[1] ="update Hzsyspersonnel set orgid='"+orgId+"',deptid='"+deptId+"',posid='"+posId+"' where personid='"+empId+"'";
        dao.transactHqlplural(hql);
        body = "调动成功"; 
    } catch (Exception ex) {
    	body = "调动失败";
        throw new BusinessException("调动失败", ex);
    } 

%>

<html>
<head>
    <%@ include file="../inc/action_components.jsp" %>
</head>

<body tt.action.result="true" tt.msg="<%=body %>">
<script>
    function afterSuccess() {
    _parent.__close();
    __invoke(_parent, "onDiaoDongFinish");
    }
</script>
</body>
</html>